//
//  BaseTableView.h
//  公考神器
//
//  Created by 毕武侠 on 16/3/10.
//  Copyright © 2016年 毕武侠. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol didSelectCellDelegate <NSObject>

- (void)tableView:(UITableView *)tableView didselectIndexPath:(NSIndexPath *)indexPath;

@optional
- (void)tableView:(UITableView *)tableView didActionIndexPath:(NSIndexPath *)indexPath infoData:(id)data;

- (void)tableView:(UITableView *)tableView loadDataAtIndex:(NSUInteger )index;

@end

@interface BaseTableView : UITableView

@property (nonatomic, strong) NSMutableArray *sourceData;

// 1 设置网络请求url和参数
@property (nonatomic, strong) NSString *url;
@property (nonatomic, strong) SGParameter *parameter;

@property (nonatomic, weak) id<didSelectCellDelegate> cellDelegate;

@property (nonatomic, strong) id data;

// 2 设置model
@property (nonatomic, strong) NSString *modelClass;
@property (nonatomic, strong) NSString *cellClassName;
@property (nonatomic, strong) NSString *identifier;

@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *message;

@property (nonatomic, assign) BOOL showLoadingImage;        // default YES
@property (nonatomic, assign) BOOL showDefaultImage;        // default YES

- (void)initstance;

// 3 注册cell
- (void)initCellClass:(NSString *)cellClassName cellIdentifier:(NSString *)identifier;
- (void)registerCellClass:(NSString *)cellClassName cellIdentifier:(NSString *)identifier;

// 4 加载上啦和下啦
- (void)initRefreshView:(NSString *)modelClass;
- (void)initRefreshViewNoFooter:(NSString *)modelClass;

- (void)setCellClass:(NSString *)cellClassName cellIdentifier:(NSString *)identifier;

- (void)refreshView;
- (void)showEmptyView;

// 5 重新加载数据
- (void)reloadNewData;

@end
